const {distributeAll} = require("./Distribute");
const {findMyRoom, findRoleCreeps} = require("./Find");
const {initDefault} = require("./Default");
const {EnumRole} = require("./Enum");
const {outHarvest, outEngineer, occupy, outWorker, outTrans, attack} = require("./Role");
module.exports.loop = ()=>{
    initDefault();
    for (let room of findMyRoom()) {
        distributeAll(room);
    }

    let allCreeps=Object.values(Game.creeps);
    let OutHarvestList=allCreeps.filter(creep=>creep.memory.role===EnumRole.OutHarvest);
    let OutEngineerList=allCreeps.filter(creep=>creep.memory.role===EnumRole.OutEngineer);
    let OccupyList=allCreeps.filter(creep=>creep.memory.role===EnumRole.Occupy);
    let OutWorkerList=allCreeps.filter(creep=>creep.memory.role===EnumRole.OutWorker);
    let OutTransList=allCreeps.filter(creep=>creep.memory.role===EnumRole.OutTrans);
    let AttackList=allCreeps.filter(creep=>creep.memory.role===EnumRole.Attack);
    OutHarvestList.forEach(OutHarvest=>{
        outHarvest(OutHarvest)
    })
    OutEngineerList.forEach(OutEngineer=>{
        outEngineer(OutEngineer);
    })
    OccupyList.forEach(Occupy=>{
        occupy(Occupy);
    })
    OutWorkerList.forEach(OutWorker=>{
        outWorker(OutWorker);
    })
    OutTransList.forEach(OutTrans=>{
        outTrans(OutTrans);
    })
    AttackList.forEach(Attack=>{
        attack(Attack);
    })
}